package me.hl.javaslang;

import javaslang.control.Try;

/**
 * Created by haoliang on 2016/7/13.
 */
public class TryTest {

    public static void divide(int a, int b) {
        Try<Integer> ans = Try.of(() -> a / b);
        ans.onFailure((throwable) -> System.out.println(throwable)).onSuccess((x) -> System.out.println(x));


    }


    public static void main(String[] args) {
        divide(1, 0);
        divide(1, 1);
    }
}
